<template>
  <div class="foot">
    <ul>
      <template v-for="link in headerLinks">
        <li
          v-if="link.type === 'static'"
          :key="link.slug"
          :class="{'hit': $route.name === link.slug, [link.slug]: true}"
        >
          <nuxt-link :to="createLink(link.slug)">
            <i :class="`iconfont ex-icon-${link.slug}`"></i>
            <span>{{ $t(link.name) }}</span>
          </nuxt-link>
        </li>
      </template>
    </ul>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import { MAIN_NAVBAR } from '@/constants/global'
export default {
  data () {
    return {
      headerLinks: MAIN_NAVBAR.headerLinks
    }
  },
  computed: {
    ...mapState({
      symbol: ({ exchange }) => exchange.symbol
    })
  },
  methods: {
    createLink (name) {
      if (name === 'exchange') {
        const query = this.symbol ? {
          symbol: this.symbol
        } : null
        return { name, query }
      }
      return { name }
    }
  }
}
</script>

<style scoped>
.foot {
  width: 100%;
  background: #fff;
  position: fixed;
  left: 0;
  bottom: 0;
  border-top: 1px solid #f3f3f3;
  padding: 10px 0 0 0;
}
.foot ul {
  width: 100%;
  float: left;
}
.foot ul li {
  width: 20%;
  float: left;
  text-align: center;
}
.foot ul li i {
  color: #bdbdbd;
  height: 20px;
  line-height: 20px;
}
.foot ul li .ex-icon-otc {
  font-size: 20px;
}
.foot ul li .ex-icon-conversion {
  font-size: 20px;
}
.ex-icon-derivatives {
  color: #bdbdbd;
  font-weight: 600;
}
.foot ul li span {
  width: 100%;
  color: #666;
  float: left;
  line-height: 20px;
}
.foot ul .hit i {
  color: #1b8afe;
}
.foot ul .hit span {
  color: #1b8afe;
}
.ex-icon-conversion:before {
  content: '\e645';
}
</style>
